<%@ page import="java.text.DecimalFormat" %>
<%@ page import="com.cakeshop.utils.LtsDistance" %>
<%@ page import="java.util.Date" %>
<%--
  Created by IntelliJ IDEA.
  User: TianXinKun
  Date: 2021/8/24
  Time: 16:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String datetime = request.getParameter("datetime");
    double lng = (double) request.getAttribute("lng");
    double lat = (double) request.getAttribute("lat");
    double distance = LtsDistance.getDistance(lng, lat);
    double delta_t = LtsDistance.Delta_T(datetime);
    double time = distance / 800000;
    DecimalFormat df = new DecimalFormat("#.0");
    String times = df.format(time+delta_t);
    String search1="none";
    String search2="none";
    String search3="none";
    if (delta_t >=-1) {
        search1="block";
    }else if (time+delta_t>=0){
        search2="block";
    }else {
        search3="block";
    }
%>

<!DOCTYPE html>
<html>
<head>
    <title>我的订单/物流详情</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link type="text/css" rel="stylesheet" href="css/style.css">
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
    <script type="text/javascript" src="layer/layer.js"></script>
    <script type="text/javascript" src="js/cart.js"></script>
    <%--txk--%>
    <link rel="stylesheet" href="css/bootstrap.css">
    <script type="text/javascript" src="//api.map.baidu.com/api?v=3.0&ak=lnzv5GzmeqVe4d92VkrpFd6WOQzbrrIe"></script>
    <style type="text/css">
        body, html, #ditu {
            width: 100%;
            height: 100%;
            overflow: hidden;
            margin: 0;
            font-family: "微软雅黑";
        }
    </style>
</head>
<body>
<jsp:include page="/header.jsp">
    <jsp:param value="5" name="flag"/>
</jsp:include>


<!--cart-items-->
<div id="ditu" style="position: absolute"></div>

<div class="container ">
    <div class="row" style="height: 10px;"></div>
    <div class="row">
        <div class="col-6 search2" style="display: <%=search2%>">
            <button class="btn btn-success" type="button" disabled style="height: 50px">
                <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
                派送中....
            </button>
            <button class="btn btn-info" type="button" disabled style="height: 50px">
                <span class="spinner-grow spinner-grow-sm text-success" role="status" aria-hidden="true"></span>
                路况良好
            </button>
            <button class="btn btn-info" type="button" disabled style="height: 50px">
                <span class="spinner-grow spinner-grow-sm text-warning" role="status" aria-hidden="true"></span>
                预计<%=times%>小时后送达
            </button>
        </div>
    </div>
    <div class="row search1" style="display: <%=search1%>">
        <div class="col-6">
            <button class="btn btn-success" type="button" disabled style="height: 50px">
                <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
                制作中....
            </button>
            <button class="btn btn-info" type="button" disabled style="height: 50px">
                <span class="spinner-grow spinner-grow-sm text-success" role="status" aria-hidden="true"></span>
                路况良好
            </button>
            <button class="btn btn-info" type="button" disabled style="height: 50px">
                <span class="spinner-grow spinner-grow-sm text-warning" role="status" aria-hidden="true"></span>
                预计<%=times%>小时后送达
            </button>
        </div>
    </div>
    <div class="row search3" style="display: <%=search3%>">
        <div class="col-6">
            <button class="btn btn-success" type="button" disabled style="height: 50px">
                <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
                已送达....
            </button>
        </div>
    </div>

</div>
<script type="text/javascript">
    var map = new BMap.Map("ditu");
    map.centerAndZoom(new BMap.Point(116.404, 39.915), 14);
    var driving = new BMap.DrivingRoute(map, {
        renderOptions: {
            map: map,
            autoViewport: true
        }
    });
    var start = new BMap.Point(119.1989061055404, 37.11644176049751);
    var end = new BMap.Point(<%=lng%>, <%=lat%>);
    driving.search(start, end);
</script>
<!--//cart-items-->
<jsp:include page="/footer.jsp"/>

</body>
</html>